package com.inossem.warehousestorage_inossem.request.storage;

import android.content.Context;

import com.google.gson.Gson;
import com.inossem.warehousestorage_inossem.bean.storage.StorageManageMaterielConfirmBean;
import com.inossem.warehousestorage_inossem.bean.storage.StorageManageMaterielConfirmRequestBean;
import com.inossem.warehousestorage_inossem.constant.RequestConstant;
import com.inossem.warehousestorage_inossem.listener.GsonBeanListener;
import com.inossem.warehousestorage_inossem.listener.StringRequestListener;
import com.inossem.warehousestorage_inossem.manage.RequestManage;
import com.inossem.warehousestorage_inossem.model.StringResponse;
import com.inossem.warehousestorage_inossem.request.Request;

/**
 * Created by leij on 2017/6/12.
 */

public class StorageManageMaterielConfirmRequest extends Request {

    public static String request(Context context, StorageManageMaterielConfirmRequestBean paramsBean, GsonBeanListener gsonBeanListener) {
        String tag;

        String url = RequestManage.getUrl(context, RequestConstant.URL_STORAGE_MANAGE_MATERIAL_CONFIRM);
        Gson gson = new Gson();
        String params = gson.toJson(paramsBean, paramsBean.getClass());
        tag = RequestManage.getHttpsPostWithLoading(context, url, params, new StringRequestListener() {
            @Override
            public void onSuccess(StringResponse stringRequestResponse) {

                String json = stringRequestResponse.getResponseInfo();
                StorageManageMaterielConfirmBean bean = gson.fromJson(json, StorageManageMaterielConfirmBean.class);
                excuteJsonBeanNew(context, bean, gsonBeanListener);
            }
        });
        return tag;
    }

}
